package com.astrofizzbizz.raspberrypicamera.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.DockLayoutPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootLayoutPanel;
import com.google.gwt.user.client.ui.VerticalPanel;

public class RaspberryPiCamera implements EntryPoint 
{
	private boolean debug = false;
	private final RaspberryPiServiceAsync raspberryPiService = GWT.create(RaspberryPiService.class);
	private String version = "v1.0";
	private String versionDate = "December 9, 2013";
	private MessageDialog messageDialog;
	private String menuText[] = {"Help"};
	private String menuItemText[][] =
    {
		{"Help", "About", "Contact"}
	};
	private MyMenuBar menuBar;
	private StatusTextArea statusTextArea;
	private MyTabLayoutPanel se3TabLayoutPanel;
	private OptionDialog optionDialog;

	public boolean isDebug() {return debug;}
	public RaspberryPiServiceAsync getRaspberryPiService() {return raspberryPiService;}
	public String getVersion() {return version;}
	public String getVersionDate() {return versionDate;}
	public MessageDialog getMessageDialog() {return messageDialog;}
	public String[] getMenuText() {return menuText;}
	public String[][] getMenuItemText() {return menuItemText;}
	public MyMenuBar getMenuBar() {return menuBar;}
	public StatusTextArea getStatusTextArea() {return statusTextArea;}
	public MyTabLayoutPanel getMyTabLayoutPanel() {return se3TabLayoutPanel;}
	public OptionDialog getOptionDialog() {return optionDialog;}

	public void onModuleLoad() 
	{
	    DockLayoutPanel dockLayoutPanel1 = new DockLayoutPanel(Unit.EM);
	    Label titleLabel = new Label("Raspberry Pi Camera");
	    titleLabel.setStyleName("titleLabel");
	    dockLayoutPanel1.addNorth(titleLabel, 3);

	    menuBar = new MyMenuBar(menuText, menuItemText, this);
	    dockLayoutPanel1.addSouth(menuBar, 2);
	    DockLayoutPanel dockLayoutPanel2 = new DockLayoutPanel(Unit.EM);
	    dockLayoutPanel2.addNorth(dockLayoutPanel1, 5);
		
	    statusTextArea = new StatusTextArea();
	    statusTextArea.setMaxBufferSize(100);
	    statusTextArea.addStatus("Welcome!");
		dockLayoutPanel2.addSouth(statusTextArea, 8);
		
		VerticalPanel statusAndControlPanel = new VerticalPanel();
		dockLayoutPanel2.addWest(statusAndControlPanel, 25);

		se3TabLayoutPanel = new MyTabLayoutPanel(2.5, Unit.EM, this);
		dockLayoutPanel2.add(se3TabLayoutPanel);
		
		RootLayoutPanel.get().add(dockLayoutPanel2);
        messageDialog = new MessageDialog();
        optionDialog =  new OptionDialog();

	}
}
